package com.ghxxzx.dagl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ghxxzx.dagl.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * desc:
 *
 * @author cx316
 * Created by cx316 on 2020-05-27.
 */
@Repository
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from user where name=#{name} and phone = #{phone} limit 1")
    User findByNameAndPhone(@Param("name") String name,@Param("phone") String phone);
    @Select("select * from user where account=#{account} limit 1")
    User findByAccount(@Param("account")String account);

    @Select("select * from user where role_id=1 or role_id=2")
    List<User> selectShry();

    @Select("select * from user where role_id=1 or role_id=2")
    List<User> selectRgShry();

    @Select("select * from user where account=#{account} and password=#{password}")
    User selectByUserNameAndPassword(@Param("account") String account,@Param("password") String password);
}
